1. Field of the Invention
The present invention relates to a video encoding apparatus for compression-encoding a video picture into a small number of bits and, more particularly, to a video encoding apparatus capable of encoding data at an encoding frame rate suitable for the picture quality and decreasing the amount of delay when the encoded data is output.
The present invention also relates to an encoding apparatus for compression-encoding a picture into a small number of bits and a decoding apparatus for reconstructing the picture by decompressing the compression-encoded data and, more particularly, to a video encoding apparatus and a video decoding apparatus which have an intra-encoding mode and an inter-encoding mode and perform refresh by forcedly setting an intra-encoding domain.
2. Description of the Related Art
As a technique of compression-encoding pictures into a small number of bits to transmit or store the pictures in systems for transmitting or storing pictures such as a videophone, a teleconference system, a portable terminal, a digital video disk system, and a digital television broadcast system, various methods such as motion compensation, discrete cosine transform, subband encoding, pyramid encoding, and combinations of these methods have been developed.
In addition, ISO, MPEG1, MPEG2, ITU-T, H. 261, and H. 262 are defined as international standard systems of video compression encoding. All of these systems are compression encoding schemes which combine motion compensation adaptive prediction and discrete cosine transform, and the details are described in, e.g., reference 1 (Hiroshi Yasuda ed., "International Standard of Multimedia Encoding", Maruzen, June 1991).
When a video encoding apparatus using any of these picture compression encoding techniques encodes a video picture at a low bit rate such as 64 kbps or lower, it is difficult to encode the picture at the same frame rate as an input video signal. Therefore, a general approach is to encode an input video signal in units of a few frames to thereby perform encoding at a lowered encoding frame rate. When one frame is completely encoded, the encoded data of the frame is temporarily stored in an output buffer and output to a transmission channel or another system at a predetermined encoded data transmission speed (encoding bit rate).
The setting of the encoding frame rate is crucial because it has a large effect on the encoding quality. If the encoding frame rate is fixed and the frame rate of an input video signal is 30 Hz, discrete values such as 30 Hz, 15 Hz, 10 Hz, 7.5 Hz, 6 Hz, 5 Hz, 4.29 Hz, and 3 Hz are determined as the encoding frame rates in accordance with the number of frames as a unit of encoding. For example, the motion is satisfactory but the picture quality is low when encoding is performed at 10 Hz, and the picture quality is high but the motion is unsatisfactory when encoding is performed at 7.5 Hz. There is another problem that the picture quality abruptly degrades when a scene in which an object is moving at high speed appears.
Accordingly, encoding control which changes the encoding frame rate in accordance with a variation of the picture quality is being developed. One example is a simulation model TMN5 (ITU-T TSS LBC-95 SG15 WP15/1 VIDEO CODEC TEST MODEL, TMN5, January 1995) used in the standardizing work of H. 263 which is a video encoding standard system for PSTN (Public Switched Telephone Network). This simulation model uses an algorithm (TMN algorithm) of variable frame rate/encoding control by which the encoding frame rate changes during encoding. In the TMN algorithm, as the average of quantization parameters QP in the immediately previous frame decreases, a target encoding frame rate in the next frame is increased to decrease the target number of encoding bits (the target number of bits) in the frame.
Conversely, if the average of the quantization parameters QP in the immediately previous frame increases, the encoding frame rate in the next frame is decreased to increase the target number of bits in the frame.
When a compression encoding system like this is applied to video encoding for communication or broadcast, it is desirable that the delay of transmission of encoded data be small in order to allow real-time communication.
Unfortunately, in conventional video encoding apparatuses using an algorithm such as the TMN algorithm which controls the number of encoded bits by changing the encoding frame rate in accordance with variations of the picture quality, the delay of data transmission in an output buffer is not taken into consideration. This poses the problem that a large delay occurs when encoded data is output.
A representative example of the techniques of efficiently compression-encoding video signals is a motion compensation adaptive prediction encoding scheme which encodes (inter-frame-encodes) a prediction error signal which is the difference between an input video signal and a prediction picture signal obtained by performing motion compensation prediction for the input video signal, and transmits the encoded prediction error signal.
When this motion compensation prediction encoding scheme is applied to video encoding for communication or broadcast, it is desirable that the delay of data transmission be small in order to allow real-time communication. Also, the contents of frame memories (storage media) of an encoder and a decoder are made different from each other due to a burst error in a transmission channel. A general method of solving this problem to accomplish real-time communication or broadcast is to refresh a frame by periodically inserting a pixel region for performing intra-frame encoding into the frame, so that the number of encoded bits does not vary from one frame to another.
For example, refresh is performed as follows in the system (ISO-IEC CD13818-2) which was examined in standardization of MPEG2. That is, an intra-frame encoding mode (intra mode) and an inter-frame encoding mode (inter mode) are switched in units of 16 pixels.times.16 pixels called a macro block. In one frame including 30 vertical macro blocks.times.44 horizontal macro blocks, two horizontal macro-block lines are encoded in the intra mode, and lines are slid in units of two lines for each frame time to form one cycle with 15 frames. This method is called intra slice. When a certain region is to be encoded in the inter mode in this method, a motion vector searching range is so limited that the search is not performed from another region which has not been refreshed yet. That is, in the intra slice in which the refresh direction is downward, an upward motion vector is the direction related to the limitation. With this limitation, it is ensured that refresh is completed in (two cycles-1) times even in the worst case.
The problem of the refresh is that the number of encoded bits in the intra mode is usually twice the number of encoded bits in the inter mode for the same quantization parameter. To perform encoding at the same rate, therefore, the quantization parameter must be increased by the amount of refresh and this degrades the picture quality.
Also, if a long burst occurs in a transmission channel or a storage medium when a video picture is encoded, coded data of at least several frames cannot be correctly decoded. Consequently, in a video decoder, the decoded picture is largely degraded until refresh is done in the (two cycles-1) frame in the worst case.
Furthermore, if a motion vector is limited when there is a global motion compensation mode in which motion compensation is performed for an entire frame, it is necessary to limit the global motion vector if the vector is in the direction of limitation. This largely degrades the picture quality.